package kotlin05.src.main.java.com.example.kotlin05.s01

/**
 * infix
 */
fun main() {
//    val nullableString : String? = null
    val nullableString : String? = "ohh"
//    nullableString.printWithDefault("abc")
    //用infix关键字修饰可以写成这样形式
    nullableString printWithDefault "abc"

    //类似于
//    "jack".to(20)
//    mapOf("jack" to 20)


}

//fun String?.printWithDefault(default:String) = println(this ?: default)
infix fun String?.printWithDefault(default:String) = println(this?: default)